const Base = require('../base.js');
module.exports = class extends Base {
    async __before() {
        try {
          this.xcxip = this.ctx.header["x-real-ip"] || "127.0.0.1";
        } catch (e) {
          this.xcxip = "127.0.0.1";
        }
    }
    async indexAction() {
        let city = ""
        let qer = ""
        try {
            const { content } = await this.dxGet("https://api.map.baidu.com/location/ip?ak=Vv4btjr4PQrpGIYG4XO6j7TnDCWgoOyO&coor=bd09ll&ip=" + this.xcxip)
            city = content.address_detail.city
        } catch (e) {

        }
        this.success(city)
    }
}